home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / libraries / mui20dev.lha / MUI / Developer / C / Examples / demo.h < prev    next >
C/C++ Source or Header  |  1994-02-11  |  2KB  |  138 lines

  1. /*************************************************************/
  2. /* Includes and other common stuff for the MUI demo programs */
  3. /*************************************************************/
  4.  
  5. /* MUI */
  6. #include <libraries/mui.h>
  7.  
  8. /* System */
  9. #include <dos/dos.h>
  10. #include <graphics/gfxmacros.h>
  11. #include <workbench/workbench.h>
  12.  
  13. /* Prototypes */
  14. #include <clib/alib_protos.h>
  15. #include <clib/exec_protos.h>
  16. #include <clib/dos_protos.h>
  17. #include <clib/icon_protos.h>
  18. #include <clib/graphics_protos.h>
  19. #include <clib/intuition_protos.h>
  20. #include <clib/gadtools_protos.h>
  21. #include <clib/utility_protos.h>
  22. #include <clib/asl_protos.h>
  23. #include <clib/muimaster_protos.h>
  24.  
  25. /* ANSI C */
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include <stdio.h>
  29.  
  30.  
  31. /* Compiler specific stuff */
  32.  
  33. #ifdef _DCC
  34.  
  35. #define REG(x) __ ## x
  36. #define ASM
  37. #define SAVEDS __geta4
  38.  
  39. #else
  40.  
  41. #define REG(x) register __ ## x
  42.  
  43. #ifdef __MAXON__
  44. #define ASM
  45. #define SAVEDS
  46. #else
  47. #define ASM    __asm
  48. #define SAVEDS __saveds
  49. #endif
  50.  
  51. #include <pragmas/exec_pragmas.h>
  52. #include <pragmas/dos_pragmas.h>
  53. #include <pragmas/icon_pragmas.h>
  54. #include <pragmas/graphics_pragmas.h>
  55. #include <pragmas/intuition_pragmas.h>
  56. #include <pragmas/gadtools_pragmas.h>
  57. #include <pragmas/utility_pragmas.h>
  58. #include <pragmas/asl_pragmas.h>
  59. #include <pragmas/muimaster_pragmas.h>
  60.  
  61. extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase;
  62. struct Library *MUIMasterBase;
  63.  
  64. #endif
  65.  
  66.  
  67. /*************************/
  68. /* Init & Fail Functions */
  69. /*************************/
  70.  
  71. static VOID fail(APTR app,char *str)
  72. {
  73.     if (app)
  74.         MUI_DisposeObject(app);
  75.  
  76. #ifndef _DCC
  77.     if (MUIMasterBase)
  78.         CloseLibrary(MUIMasterBase);
  79. #endif
  80.  
  81.     if (str)
  82.     {
  83.         puts(str);
  84.         exit(20);
  85.     }
  86.     exit(0);
  87. }
  88.  
  89.  
  90. #ifdef _DCC
  91.  
  92. int brkfunc(void) { return(0); }
  93.  
  94. int wbmain(struct WBStartup *wb_startup)
  95. {
  96.     extern int main(int argc, char *argv[]);
  97.     return (main(0, NULL));
  98. }
  99.  
  100. #endif
  101.  
  102.  
  103. #ifdef __SASC
  104. int CXBRK(void) { return(0); }
  105. int _CXBRK(void) { return(0); }
  106. void chkabort(void) {}
  107. #endif
  108.  
  109.  
  110. static VOID init(VOID)
  111. {
  112. #ifdef _DCC
  113.     onbreak(brkfunc);
  114. #endif
  115.  
  116. #ifndef _DCC
  117.     if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  118.         fail(NULL,"Failed to open "MUIMASTER_NAME".");
  119. #endif
  120. }
  121.  
  122.  
  123. #ifndef __SASC
  124. static VOID stccpy(char *dest,char *source,int len)
  125. {
  126.     strncpy(dest,source,len);
  127.     dest[len-1]='\0';
  128. }
  129. #endif
  130.  
  131.  
  132. #ifndef MAKE_ID
  133. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  134. #endif
  135.  
  136.  
  137. LONG __stack = 8192;
  138.